<?php

use App\Http\Controllers\ChirpsController;
use App\Http\Controllers\ContactsController;
use App\Http\Controllers\ImagesController;
use App\Http\Controllers\OrganizationsController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\ReportsController;
use App\Http\Controllers\UsersController;

use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return Inertia::render('Welcome', [
        'canLogin' => Route::has('login'),
        'canRegister' => Route::has('register'),
        'laravelVersion' => Application::VERSION,
        'phpVersion' => PHP_VERSION,
    ]);
});



Route::middleware(['auth', 'verified'])->group(function () {
    Route::get('/dashboard', function () {
        return Inertia::render('Dashboard');
    })->name('dashboard');
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
    
    Route::resource('chirps', ChirpsController::class)->only(['index', 'store', 'update', 'destroy']);
    Route::resource('users', UsersController::class)->only(['index', 'create', 'store', 'edit', 'update', 'destroy']);
    Route::put('/users/{user}/restore', [UsersController::class, 'restore'])->name('users.restore');
    Route::resource('organizations', OrganizationsController::class)->only(['index', 'create', 'store', 'edit', 'update', 'destroy']);
    Route::put('/organizations/{organization}/restore', [OrganizationsController::class, 'restore'])->name('organizations.restore');
    Route::resource('contacts', ContactsController::class)->only(['index', 'create', 'store', 'edit', 'update', 'destroy']);
    Route::put('/contacts/{contact}/restore', [ContactsController::class, 'restore'])->name('contacts.restore');
    Route::resource('reports', ReportsController::class)->only(['index', 'create', 'store', 'edit', 'update', 'destroy']);


    Route::get('/img/{path}', [ImagesController::class, 'show'])->where('path', '.*')->name('image');
});
    
require __DIR__.'/auth.php';


